﻿using DingTalk.Core.Models;
using System.Collections.Specialized;

namespace DingTalk.Core
{
    /// <summary>
    /// 
    /// </summary>
    public interface IDingTalkService
    {
        /// <summary>
        /// 
        /// </summary>
        string Name { get; }
        /// <summary>
        /// 
        /// </summary>
        Uri AccessTokenUri { get; }
        /// <summary>
        /// 
        /// </summary>
        string AccessToken { get; }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        void ResetAccessToken();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="adapterName"></param>
        /// <param name="serviceName"></param>
        /// <param name="method"></param>
        /// <param name="queryString"></param>
        /// <param name="headers"></param>
        /// <param name="requestData"></param>
        /// <returns></returns>
        Task<string> InvokeAPIAsync(string adapterName, string serviceName, string method, NameValueCollection queryString, NameValueCollection headers, string requestData = null);
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="uri"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        Task<T> HttpGetAsync<T>(Uri uri, SerializeMode mode = SerializeMode.Json) where T : StandardResponse;
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TR"></typeparam>
        /// <typeparam name="TS"></typeparam>
        /// <param name="uri"></param>
        /// <param name="requestObj"></param>
        /// <param name="mode"></param>
        /// <returns></returns>
        Task<TS> HttpPostAsync<TR, TS>(Uri uri, TR requestObj, SerializeMode mode = SerializeMode.Json) where TR : class where TS : StandardResponse;
    }
}
